package org.learn.effective.java.chapter6;

public class Article34 {

    public static void main(String[] args) {
        Operation[] values = Operation.values();
        for (Operation op : values) {
            System.out.println(op.name());
        }
    }

}

enum Operation {

    PLUS { public double apply(double x, double y) { return x + y; } },
    MINUS { public double apply(double x, double y) { return x - y; } },
    TIMES { public double apply(double x, double y) { return x * y; } },
    DIVIDE { public double apply(double x, double y) { return x / y; } };

    public abstract double apply(double x, double y);
}